package zadanie.Ch7homework.src;

import java.util.Date;

public class Car {

	private String brand;
	private Date manufactureDate;

	Car(String brand, Date manufactureDate) {
		setBrand(brand);
		setManufactureDate(manufactureDate);
	}

	public String getBrand() {
		return this.brand;
	}

	public void setBrand(String brand) {
		this.brand = brand;
	}

	public Date getManufactureDate() {
		return this.manufactureDate;
	}

	public void setManufactureDate(Date manufactureDate) {
		this.manufactureDate = manufactureDate;
	}

	protected Integer getCarAge(Car car) {
		Integer currectYear = Person.getCurrentYear();
		String fullDateOfmanufactur = getManufactureDate().toString();
		fullDateOfmanufactur = fullDateOfmanufactur
				.substring(fullDateOfmanufactur.length() - 4);
		Integer carYear = currectYear - Integer.parseInt(fullDateOfmanufactur);
		return carYear;
	}
}
